package com.woniu.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniu.entity.Product;
import com.woniu.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author huangjianbin
 * @since 2023-02-07 11:59:17
 */
@RestController
@RequestMapping("/product")
public class ProductController {

    @Autowired
    ProductService productService;

    @RequestMapping("pageData")
    public Page<Product> pageData(Integer currentPage, Integer pageSize){

        Page<Product> pageData = productService.pageData(currentPage, pageSize);

        return pageData;
    }

    @RequestMapping("search")
    public Page<Product> search(Integer currentPage,Integer pageSize,String keyword){
        Page<Product> searchResult=productService.search(currentPage,pageSize,keyword);
        return searchResult;
    }
}

